<script src="<?=base_url("js/jquery.validationEngine-vi.js")?>"></script>
<script src="<?=base_url("js/jquery.validationEngine.js")?>"></script>
<script src="<?=base_url("js/jquery.motionCaptcha.0.2.js")?>"></script>
<script src="<?=base_url("js/jquery.motionCaptcha.0.2.js")?>"></script>
<form class="dangky" action="<?=base_url('index.php/taikhoan_controller/dangkythanhcong')?>" method="post" enctype="multipart/form-data">
<div class="dangky ui-widget-header">Đăng Ký</div>
<div class="dangkycontent ui-widget-content">
    <fieldset>
        <legend class="tieude">Thông tin tài khoản</legend>
        <table cellpadding="10px">
            <tr class="canhtrai">
                <td>Tên đăng nhập</td>
                <td><input type="text" name="tendangnhap" id="tendangnhap" class="ui-widget validate[required, ajax[ajaxkiemtrataikhoan]] text-input"/></td>
            </tr>
            <tr class="canhtrai">
                <td>Mật khẩu</td>
                <td><input type="password" name="matkhaudk" id="matkhaudk" class="ui-widget validate[required] text-input"/></td>
            </tr>
            <tr class="canhtrai">
                <td>Xác nhận mật khẩu</td>
                <td><input type="password" name="xacnhanmatkhau" id="xacnhanmatkhau" class="ui-widget validate[required,equals[matkhaudk]] text-input"/></td>
            </tr>
            <tr class="canhtrai">
                <td >Ảnh đại diện</td>
                <td><input type="file" accept="image/*" name="anhdaidien" id="anhdaidien"/></td>
            </tr>
            <tr>
                <td>Đăng ký với quyền</td>
                <td>
                    <input type="checkbox" id="nguoidang" name="checkbox[]" value="1" class="validate[minCheckbox[1]] checkbox"/><span>Người đăng</span>
                    <input type="checkbox" id="nguoidanhgia" name="checkbox[]" value="2" class="validate[minCheckbox[1]] checkbox"/><span>Người đánh giá </span>
                </td>
            </tr>
        </table>
    </fieldset>
    <fieldset>
        <legend class="tieude">Thông tin cá nhân</legend>
        <table cellpadding="10px">
            <tr class="canhtrai">
                <td>Họ tên</td>
                <td><input type="text" name="hoten" id="hoten" class="ui-widget validate[required]"/></td>
            </tr>
            <tr class="canhtrai">
                <td>Địa chỉ</td>
                <td><input type="text" name="diachi" id="diachi" class="ui-widget validate[required]"/></td>
            </tr>
            <tr class="canhtrai">
                <td>Ngày sinh:</td>
                <td><input type="text" name="ngaysinh" id="ngaysinh" class="ui-widget validate[required]"/></td>
            </tr>
            <tr class="canhtrai">
                <td>Email</td>
                <td><input type="text" name="email" id="email" class="ui-widget"/></td>
            </tr>
            <tr class="canhtrai">
                <td>Số điện thoại</td>
                <td><input type="text" name="sodienthoai" id="sodienthoai" class="ui-widget"/></td>
            </tr>
        </table>
    </fieldset>
    <table cellpadding="10px" width="790">
        <tr>
                <td id="hinhxacnhan"colspan="2" class="ui-state-error">
                    <p>Hãy vẽ theo hình sau để xác nhận:</p>
                    <canvas id="mc-canvas" style="margin-left: 300px"></canvas>
                    <input type="hidden" id="mc-action" value="<?=base_url('index.php/taikhoan_controller/dangkythanhcong')?>" />
                </td>
        </tr>
    </table>
    <div class="canhduoi">
        <input type="submit" disabled="disable" class="ui-button ui-corner-all ui-state-error" id="btn_dongy" value="Đồng ý"/>
        <input type="button" class="ui-button ui-corner-all" id="btn_huybo" value="Hủy bỏ"/>
    </div>
</div>
</form>
<script>
    $('.dangky').validationEngine();
    $('.btn_huybo').click(function(){
        //window.location.href = '<?=base_url()?>';
    });
    $('.dangky').motionCaptcha({
        shapes: ['triangle', 'x', 'rectangle', 'circle', 'check', 'caret', 'zigzag', 'arrow', 'leftbracket', 'rightbracket', 'v', 'delete', 'star', 'pigtail'],
        cssClass: '.mc-active',  
        errorMsg: 'Hãy vẽ lại',
        successMsg: 'Xác nhận thành công!!!',
    });
    $('#mc-canvas').click(function(){
        if($('#btn_dongy').attr('disabled') != 'disabled')
        {
            $('#hinhxacnhan').attr('class', 'ui-state-active');
            $('#btn_dongy').attr('class', 'ui-button ui-corner-all ui-state-active');
        }
    });
    $('#ngaysinh').datepicker();
    $('#tendangnhap').change(function(){
        alert('a');
    });
</script>